/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.h;

import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import javax.crypto.Cipher;

public class i {
    private static final byte[] a = { 48, -127, -97, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, 1, 5, 0, 3, -127,
            -115, 0 };
    private RSAPublicKey b;

    public i(byte[] paramArrayOfByte) {
        byte[] arrayOfByte = null;
        if (paramArrayOfByte.length == 140) {
            arrayOfByte = new byte[162];
            for (int i = 0; i < a.length; ++i)
                arrayOfByte[i] = a[i];
            for (int j = 0; i < 162; ++j) {
                arrayOfByte[i] = paramArrayOfByte[j];
                ++i;
            }
        }
        else if (paramArrayOfByte.length == 162) {
            arrayOfByte = paramArrayOfByte;
        }
        else {
            throw new RuntimeException("Invalid Buffer Length: " + paramArrayOfByte.length + " of Public Key");
        }
        KeyFactory localKeyFactory = KeyFactory.getInstance("RSA");
        X509EncodedKeySpec localX509EncodedKeySpec = new X509EncodedKeySpec(arrayOfByte);
        this.b = ((RSAPublicKey) localKeyFactory.generatePublic(localX509EncodedKeySpec));
    }

    public byte[] a(byte[] paramArrayOfByte) {
        RSAPublicKey localRSAPublicKey = this.b;
        Cipher localCipher = Cipher.getInstance("RSA/None/PKCS1Padding");
        localCipher.init(1, localRSAPublicKey);
        byte[] arrayOfByte = localCipher.doFinal(paramArrayOfByte);
        return arrayOfByte;
    }
}